#!/usr/bin/env bash

INOTIFY=/usr/bin/inotifywait
${INOTIFY} -mrq --format '%w%f' -e create,close_write,delete /data |while read file
do
    cd / && \
        rsync -az ./data --delete rsync_backup@192.168.56.199::backup/ \
              --password-file=/etc/rsync.password
done
